<script setup>
// 导入组件
import Leftnav from "@/components/leftnav.vue";
import Navcon from "@/components/navcon.vue";
import {ref,getCurrentInstance} from "vue";
// import mitt from 'mitt'
const appContext = getCurrentInstance().appContext;
// const bus = mitt()
const showclass = ref('asideshow');
const showtype = ref(false);

const toggle = () =>{
    // 监听
    appContext.config.globalProperties.$bus.on('toggle', value => {
      if (value) {
        showclass.value = 'asideshow'
      } else {
        setTimeout(() => {
          showclass.value = 'aside'
        }, 300)
      }
    })
  }
toggle();
</script>
<template>
  <el-container class="index-con">
    <el-aside :class="showclass">
      <leftnav/>
    </el-aside>
    <el-container class="main-con">
      <el-header class="index-header">
        <navcon style="width: 100%;height: 100%">

        </navcon>

      </el-header>
      <el-main class="index-main">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>
<style >


.index-con {
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}
.index-header{
  height: 10%;
  padding: 0;
  /*border-left: 1px solid #f0f2f5;*/
}
.index-main{

}
.aside {
  width: 64px !important;
  height: 100%;
  background-color: #028370;
  margin: 0;
}
.asideshow {
  width: 240px !important;
  height: 100%;
  background-color: #028370;
  margin: 0;
}

</style>
